-define(gen_handle_call, 
        handle_call({Function,Args}, _From, State)->
            apply(?MODULE,Function,[State|Args]);
        handle_call({Function}, _From, State)->
            ?MODULE:Function(State)).
 
-define(gen_handle_cast, 
        handle_cast({Function,Args}, State)->  
            %io:format("Function ~p,Args ~p~n",[Function,[State|Args]]),         
            apply(?MODULE,Function,[State|Args]);
        handle_cast({Function},State)->                     
            ?MODULE:Function(State)).

-define(gen_handle_info,
        handle_info({Function},State) ->                 
            ?MODULE:Function(State)).

-define(define_cast(CallName),
        CallName()->
            gen_server:cast(?SERVICE_NAME,{CallName})). 

-define(define_cast1(CallName,Arg1),
        CallName(Arg1)->
            gen_server:cast(?SERVICE_NAME,{CallName,[Arg1]})). 

-define(define_cast2(CallName,Arg1,Arg2),
        CallName(Arg1,Arg2)->
            gen_server:cast(?SERVICE_NAME,{CallName,[Arg1,Arg2]})). 

-define(define_call(CallName),
        CallName()->
            gen_server:call(?SERVICE_NAME,{CallName})).

-define(define_call1(CallName,Arg1),
        CallName(Arg1)->
            gen_server:call(?SERVICE_NAME,{CallName,[Arg1]})). 

-define(define_call2(CallName,Arg1,Arg2),
        CallName(Arg1,Arg2)->
            gen_server:call(?SERVICE_NAME,{CallName,[Arg1,Arg2]})). 




       